package com.it.you.pojo;

public class Parent {

    private String name;

    private Child child;

    public Parent() {
    }

    public Parent(String name, Child child) {
        this.name = name;
        this.child = child;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Child getChild() {
        return child;
    }

    public void setChild(Child child) {
        this.child = child;
    }

    public boolean hasSon() {
        return child != null && child.getSex() == 1;
    }

    @Override
    public String toString() {
        return "Parent{" +
                "name='" + name + '\'' +
                ", child=" + child +
                '}';
    }
}
